package com.hz.filesystem.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hz.common.utils.R;
import com.hz.filesystem.entity.TeacherInstructionEntity;
import com.hz.filesystem.service.TeacherInstructionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author cyl_txw
 * @email cyl_txw@gmail.com
 * @date 2023-03-26 22:21:11
 */
@RestController
@RequestMapping("teacherInstruction")
@Api(tags = "教师使用说明书管理")
public class TeacherInstructionController {
    @Autowired
    private TeacherInstructionService teacherInstructionService;

    /**
     * 获取最新教师使用书说明文档
     */
    @ApiOperation("获取最新教师使用书说明文档")
    @GetMapping("/getOne")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization",value = "token",paramType = "header",dataType = "String", required = true)
    })
    public R getOne(@RequestHeader("Authorization") String token) {
        TeacherInstructionEntity teacherInstruction = teacherInstructionService.getOne(new QueryWrapper<TeacherInstructionEntity>().orderByDesc("createtime").last("limit 1"));
        return R.ok().put("teacherInstruction", teacherInstruction);
    }

}
